int FindGreatestSumOfSubArray(int* array, int arrayLen ) {
    int i, dp[arrayLen];    //dp[i]表示以i结尾的最长数组和
    dp[0] = array[0];
    for (i = 1; i < arrayLen; i++) {
        dp[i] = MAX(dp[i-1]+array[i], array[i]);
    }
    int max = dp[0];
    for (i = 1; i < arrayLen; i++)
        if (max < dp[i]) max = dp[i];
    return max;
}